package Opgave2;

import java.util.Enumeration;

import javax.swing.tree.DefaultMutableTreeNode;

import Opgave1.Orders;


public class DefMutTreeNode{
		DefaultMutableTreeNode person, employee, customer, us_customer;
		Orders order;
		
	public static void main(String[] args){
		new DefMutTreeNode();
	}
	public DefMutTreeNode(){
			
		
		employee = new DefaultMutableTreeNode("employee");
		employee.add(new DefaultMutableTreeNode("sales_rep"));
		employee.add(new DefaultMutableTreeNode("engineer"));			
		
		us_customer = new DefaultMutableTreeNode("us_customer");		
		us_customer.add(new DefaultMutableTreeNode("local_customer"));
		us_customer.add(new DefaultMutableTreeNode("regional_customer"));
		
		customer = new DefaultMutableTreeNode("customer");
		customer.add(new DefaultMutableTreeNode("non_us_customer"));
		customer.add(us_customer);
		
		person = new DefaultMutableTreeNode("person");
		person.add(employee);
		person.add(customer);
		
		String breadthFirstEnumeration = "";
		Enumeration bf = person.breadthFirstEnumeration();
		while(bf.hasMoreElements()){
			breadthFirstEnumeration += bf.nextElement().toString() + " ";			
		}
		
		System.out.println(breadthFirstEnumeration);	
		
		
	}
}